<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>

    <style>
        [ v-cloak] {
            display: none;
        }
    </style>
</head>

<body>


    <div id="app">
        <h1  v-cloak>{{msg}}</h1>

        <label for="">男</label>
        <input type="radio"  value="1"   name='sex'  v-model='sex'> 
        <label for="">女</label>
        <input type="radio"  value="2"    name='sex'  v-model='sex'> 

        <button @click='change'>点击</button>
    </div>
    <script src="./vue.js"></script>
    <script>
        var vm = new Vue({
            el: '#app',
            data: {
                msg: 'vue',
                sex:'2'
            },
            methods: {
                    change() {
                        setInterval(() => {
                            console.log(1)
                            this.sex=='1'?this.sex='2':this.sex='1' 
                        }, 1000);
                    },
            
            },
            mounted() {
                // 别人给你写了8个函数 你要学会自己去调用
                 this.change()
             },
           


        });
    </script>
</body>

</html>